<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/base.css" />
<link rel="stylesheet" href="css/util.css" />
<link rel="stylesheet" href="css/collect.css" />
<title>模板列表</title>
<style>
.head_area .public_input span{
	width: 100px;font-size: 18px;
}
.head_area .public_input input,
.head_area .public_input select{
	width: 280px;margin-left: 10px;
}
</style>
</head>
<body>
<div class="content ill_manage">
	<div class="navigate_head clearfix">
		<p class="navi_current" onclick="window.location.href='template_list.html'">模板列表</p>
		<p onclick="window.location.href='add_template.html'">添加模板</p>
		<p class="navi_null"></p>
	</div>
	<!--头部功能-->
	<div class="head_area flex_vertical" style="display: block;">
		<div class="public_input">
			<span >疾病名称：</span>
			<input type="text" class="proj_name" placeholder="搜索疾病"/>
		</div>
		<div class="public_input">
			<span>模板分类：</span>
			<select class="template_type">
				<option>请选择</option>
				<option value="1" selected="selected">医院模板</option>
				<option value="2">医美模板</option>
			</select>
		</div>
		<button class="search">搜索</button>
		<!--&nbsp;<button class="" style="position: absolute;right: 0;top: 0;">导出表格</button>-->
	</div>
	<table>
		<thead class="hos_table">
			<tr>
				<td>序号</td>
				<td>疾病名称</td>
				<td>科室</td>
				<td>子科室</td>
				<!--<td>症断</td>
				<td>主诉</td>-->
				<td>约定周期(天)</td>
				<td>约定价格(元)</td>
				<td>操作</td>
			</tr>
		</thead>
		<thead class="em_table none">
			<tr>
				<td>序号</td>
				<td>项目名称</td>
				<td>部位</td>
				<td>约定周期(天)</td>
				<td>约定价格(元)</td>
				<td>操作</td>
			</tr>
		</thead>
		<tbody class="tbody">
			
		</tbody>
	</table>
	<!--分页-->
	<div class="page flex_vertical">
		<button class="" onclick="indexPage()">首页</button>&nbsp;
		<button class="" onclick="backPage()"><上一页</button>&nbsp;
		<!--页码-->
		<p class="page_num">
			<!--<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span>-->
		</p>....
		<button class="" onclick="nextPage()">下一页></button>&nbsp;
		<button class="" onclick="endPage()">末页</button>&nbsp;
		共<span class="all_recode">0 </span>记录&nbsp;|
		共<span class="all_page">0 </span>页&nbsp;
		到第<input class="select_page" />页&nbsp;
		<button class="confirm_page" onclick="skipPage()">确定</button>
	</div>
</div>
<script type="text/javascript" src="plug/jquery-1.11.3.js" ></script>
<script type="text/javascript" src="plug/template-web.js"></script>
<script type="text/javascript" src="plug/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="js/toggle.js" ></script>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/method.js"></script>
<script type="text/javascript" src="js/page.js"></script>
<script type="text/javascript" src="js/detail/ill.js"></script>
<!--疾病列表-->
<script id="test_ill_list" type="text/html">
	{{each data as value i}}
		<tr>
			<td width="40px">{{i+1}}</td>
			<td>{{value.name}}</td>
			<td>{{value.subject}}</td>
			<td>{{value.subSubject}}</td>
			<!--<td>{{value.diagnosis}}</td>-->
			<!--<td>{{value.keyword}}</td>-->
			<!--<td>{{value.mainStatement}}</td>-->
			<td width="120px">{{value.minDay}}-{{value.maxDay}}天</td>
			<td width="150px">{{value.minPrice}}-{{value.maxPrice}}</td>
			<td width="100px" data_id="{{value.id}}">
				<!--<p class="font_green">设为常见病</p>-->
				<!--<p class="font_green">查看详情</p>-->
				<p class="font_green" onclick="ill_edit(this)">编辑</p>
				<!--<p class="font_green">删除</p>-->
			</td>
		</tr>
	{{/each}}
</script>
<!--模板列表-->
<script id="test_template_list" type="text/html">
	{{each data as value i}}
		<tr>
			<td width="40px">{{i}}</td>
			<td>{{value.name}}</td>
			<td>{{value.subSubjectName}}</td>
			<td width="120px">{{value.minDay}}-{{value.maxDay}}天</td>
			<td width="150px">{{value.maxPrice}}</td>
			<td width="100px" data_id="{{value.id}}">
				<!--<p class="font_green">设为常见病</p>-->
				<!--<p class="font_green">查看详情</p>-->
				<p class="font_green" onclick="ill_edit(this)">编辑</p>
				<!--<p class="font_green">删除</p>-->
			</td>
		</tr>
	{{/each}}
</script>
<script>

	window.localStorage.setItem("ill_template_type",1);//默认医院类型
	var template_type_val = 1;//默认医院类型
	var hos_url = "/admin/diseaseTemplate/getList.json";
	$(".template_type").change(function(){
		template_type_val = $(".template_type").val();
		if(template_type_val==1){
			console.log("医院类型");
			$(".hos_table").show();
			$(".em_table").hide();
			hos_url = "/admin/diseaseTemplate/getList.json";
			reqPage(control_page.getData());
			window.localStorage.setItem("ill_template_type",1);
		}
		if(template_type_val==2){
			console.log("医美类型");
			$(".hos_table").hide();
			$(".em_table").show();
			hos_url = "/admin/beautyTemplate/getList.json";
			reqPage(control_page.getData());
			window.localStorage.setItem("ill_template_type",2);
		}
	});


//编辑账号
function ill_edit(m){
	var ill_id = $(m).parents().attr("data_id");
	console.log(ill_id);
	window.localStorage.setItem("ill_id",ill_id);
	window.location.href="edit_template.html";
}

//请求方法
function reqPage(data){
	console.log(data);
	control_page.init_page(data,function(data){
		//调用ajax
		$.get_ajax(hos_url,data,function(data){
			console.log(data);
			if(template_type_val==1){
				var html = template('test_ill_list',data);
				$(".tbody").html(html);
			}
			if(template_type_val==2){
				var html = template('test_template_list',data);
				$(".tbody").html(html);
			}
			
			//初始化分页
			control_page.currentPage(control_page.page_num,data.totalCount);
			
		});
	});
}
</script>
<script>
$(function(){
	reqPage(control_page.getData());
});
</script>
</body>
</html>
